import time
from selenium import webdriver

INPUT_FULLL_NAME = ("id", "userName")
INPUT_EMAIL = ("id", "userEmail")
INPUT_CURRENT_ADDRESS = ("id", "currentAddress")
INPUT_PERMANENT_ADDRESS = ("id", "permanentAddress")
BUTTON_SUBMIT = ("id", "submit")


name = "Ivan"
email = "ivanv_ivanov@gmail.com"
current_address = "Moscow"
permanent_address = "Saint-Petersburg"

driver = webdriver.Chrome()
# driver.maximize_window()
driver.get("https://demoqa.com/text-box")

field_input_full_name = driver.find_element(*INPUT_FULLL_NAME)
field_input_email = driver.find_element(*INPUT_EMAIL)
field_input_current_address = driver.find_element(*INPUT_CURRENT_ADDRESS)
field_input_permanent_address = driver.find_element(*INPUT_PERMANENT_ADDRESS)
click_button = driver.find_element(*BUTTON_SUBMIT)

field_input_full_name.clear()
assert field_input_full_name.get_attribute("value") == ""
field_input_full_name.send_keys(f"{name}")
assert field_input_full_name.get_attribute("value") == f"{name}"

field_input_email.clear()
assert field_input_email.get_attribute("value") == ""
field_input_email.send_keys(f"{email}")
assert field_input_email.get_attribute("value") == f"{email}"

field_input_current_address.clear()
assert field_input_current_address.get_attribute("value") == ""
field_input_current_address.send_keys(f"{current_address}")
assert field_input_current_address.get_attribute("value") == f"{current_address}"

field_input_permanent_address.clear()
assert field_input_permanent_address.get_attribute("value") == ""
field_input_permanent_address.send_keys(f"{permanent_address}")
assert field_input_permanent_address.get_attribute("value") == f"{permanent_address}"

click_button.click()
time.sleep(5)
